<template>
  <div class="indices-content">
    <div class="img"></div>
    <div class="text">
      <div class="title">{{ title }}</div>
      <div class="level">{{ level }}</div>
    </div>
    <div class="left">></div>
  </div>
</template>

<script setup>
import { ref } from "vue";

const props = defineProps({
  title: {
    type: String,
  },
  level: {
    type: String,
  },
  x: {
    type: String,
  },
  y: {
    type: String,
  },
  index: {
    type: Number,
  },
});

const bgColor = ref("");

switch (true) {
  case props.index == 0:
    bgColor.value = "#95B359";
    break;
  case props.index == 1:
    bgColor.value = "#B145C6";
    break;
  case props.index == 2:
    bgColor.value = "#F18720";
    break;
  case props.index == 3:
    bgColor.value = "#FFC805";
    break;
  case props.index == 4:
    bgColor.value = "#95B359";
    break;
  case props.index == 5:
    bgColor.value = "#95B359";
    break;
  case props.index == 6:
    bgColor.value = "#C7BC13";
    break;
  case props.index == 7:
    bgColor.value = "#A9A538";
    break;
}
</script>

<style lang="less" scoped>
.indices-content {
  display: flex;
  margin: 10px;
  padding: 16px;
  border-radius: 16px;
  background-color: #fff;

  .img {
    width: 50px;
    height: 50px;
    margin-left: 20px;
    margin-right: 14.5px;
    border-radius: 50%;
    background: url(@/assets/img/indices-icon.png);
    background-repeat: no-repeat;
    background-size: 438px;
    background-color: v-bind("bgColor");
    float: left;
    background-position: v-bind("props.x") v-bind("props.y");
  }
  .text {
    flex: 1;
    margin: auto;
    .title {
      font-size: 16px;
      font-weight: 500;
    }
    .level {
      margin-top: 7px;
      font-size: 15px;
      color: rgba(0, 0, 0, 0.5);
    }
  }
  .left {
    text-align: center;
    align-items: center;
    margin: auto 0;
    font-size: 20px;
    margin-right: 10px;
  }
}
</style>